package edu.fdzc.big_event.Validation;

import edu.fdzc.big_event.anno.State;
import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;

public class StateValidation implements ConstraintValidator<State,String> {

    /**
     * @param s 要检验的数据
     * @param constraintValidatorContext context in which constraint is evaluated
     * @return 如果返回false,校验不通过，true 通过
     */
    @Override
    public boolean isValid(String s, ConstraintValidatorContext constraintValidatorContext) {
        if(s==null){
            return false;
        }
        if(s.equals("已发布")|| s.equals("草稿")){
            return true;
        }
        return false;
    }


}
